package com.imchen.cms.cmsweb.controller;

import com.imchen.cms.model.Template;
import com.imchen.cms.service.TemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author imchen
 * @create: 2019-02-13 12:20
 **/
@RestController
@RequestMapping("/template")
public class TemplateController implements BaseController<Template> {

    @Autowired
    private TemplateService service;

    @Override
    @PostMapping("/add")
    public HashMap add(@RequestBody Template template) throws Exception {
        return service.add(template);
    }

    @Override
    public int remove(int id) {
        return service.removeById(id);
    }

    @Override
    public int delete(int id) {
        return 0;
    }

    @Override
    public int update(Template template) {
        return service.update(template);
    }

    @Override
    public HashMap<String, Object> find(int id) {
        return null;
    }
}
